
################################################################################
CMAKE_MINIMUM_REQUIRED (VERSION 2.6) 
PROJECT( vrHandSim )
LIST( APPEND CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/CMake )

################################################################################
# Build Options

#SET( BUILD_VERBOSE "YES" )

SET( BUILD_DEBUG ON )
SET( ${PROJECT_NAME}_VERSION_CMAKE 1.0 )
SET( CUDA_SUPPORTED ON )
SET( TEXTURE_SUPPORTED ON )
SET( FILE_LOAD_PATH_CMAKE "${PROJECT_SOURCE_DIR}/data/" )
SET( DEFE_INSTALL_PATH "/data/projects/defE/install" )
SET( VECTORMATH_DEBUG ON )

################################################################################
# Test Dependencies

FIND_PACKAGE( OpenGL QUIET REQUIRED )
IF( OPENGL_FOUND )
    SET( OPENGL_SUPPORTED ON )
ELSE( OPENGL_FOUND )
    SET( OPENGL_SUPPORTED OFF )
    MESSAGE( "Error!, cannot find OpenGL library" )
    # todo
    # run the cmake command to exit the process
ENDIF( OPENGL_FOUND )

FIND_PACKAGE( DevIL QUIET REQUIRED )
IF( IL_FOUND )
    SET( TEXTURE_SUPPORTED ON )
ELSE( IL_FOUND )
    SET( TEXTURE_SUPPORTED OFF )
ENDIF( IL_FOUND )

FIND_PACKAGE( CUDA QUIET REQUIRED )
IF( CUDA_FOUND )
    SET( CUDA_SUPPORTED ON )
ELSE( CUDA_FOUND )  
    SET( CUDA_SUPPORTED OFF )
ENDIF( CUDA_FOUND )

# debug
#SET( TEXTURE_SUPPORTED OFF )
#SET( CUDA_SUPPORTED OFF )


################################################################################
# Preprocess

INCLUDE( BuildFunctions )

IF( BUILD_DEBUG )
    SET( CMAKE_BUILD_TYPE Debug )
ENDIF( BUILD_DEBUG )

IF( VECTORMATH_DEBUG )
    SET( VECTORMATH_DEBUG_CMAKE 1 )
ELSE( VECTORMATH_DEBUG )
    SET( VECTORMATH_DEBUG_CMAKE 0 )
ENDIF( VECTORMATH_DEBUG )

IF( OPENGL_SUPPORTED )
    SET( OPENGL_SUPPORTED_CMAKE 1 )
ELSE( OPENGL_SUPPORTED )
    SET( OPENGL_SUPPORTED_CMAKE 0 )
ENDIF( OPENGL_SUPPORTED )

IF( CUDA_SUPPORTED )
    SET( CUDA_SUPPORTED_CMAKE 1 )
ELSE( CUDA_SUPPORTED )
    SET( CUDA_SUPPORTED_CMAKE 0 )
ENDIF( CUDA_SUPPORTED )

IF( TEXTURE_SUPPORTED )
    SET( TEXTURE_SUPPORTED_CMAKE 1 )
ELSE( TEXTURE_SUPPORTED )
    SET( TEXTURE_SUPPORTED_CMAKE 0 )
ENDIF( TEXTURE_SUPPORTED )

# configure a header file to pass some of the CMake settings
# to the source code
CONFIGURE_FILE (
      "${PROJECT_SOURCE_DIR}/Config.h.in"
      "${PROJECT_SOURCE_DIR}/sources/vhand/Config.h" )
       
################################################################################
# Further parse the Dependency recursively

ADD_SUBDIRECTORY( sources )
#ADD_SUBDIRECTORY( demo )

################################################################################

